﻿@{
    ViewBag.Title = "新建客户";
    if (ViewData["act"] != null)
    {
        Layout = "~/Areas/SystemManage/Views/Shared/_Layout.cshtml";
    }
    else
    {
        Layout = "~/Areas/SystemManage/Views/Shared/_Form.cshtml";
    }
}
@*https://www.cnblogs.com/linjiqin/p/3431835.html*@
<script src="~/js/datepicker/WdatePicker.js"></script>
<script>
    var keyValue = $.request("keyValue");
    var mobile = $.request("mobile");
    $(function () {
        initControl();
        if (!!keyValue || !!mobile) {
            $.ajax({
                url: "/SystemManage/SysMemScore/GetFormJson",
                data: { keyValue: keyValue, mobile: mobile },
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#form1").formSerialize(data);
                    $("#memberId").val(data.Id);
                }
            });
        }
    })
    function initControl() {
        $("#GroupId").bindSelect({
            url: "/SystemManage/SysMemGroup/GetTreeSelectJson",
        });
    }
    function submitForm() {
        if (!$('#form1').formValid()) {
            $.modalMsg("未输入或验证未通过");
            return false;
        }
        var groupId = $('#GroupId').val();
        if (groupId === "" || groupId === "-1") {
            $.modalMsg("请选择分组");
            return false;
        }
        keyValue = $("#memberId").val();
        var postData = $("#form1").formSerialize();
        $.submitForm({
            url: "/SystemManage/SysMemScore/SubmitForm?keyValue=" + keyValue,
            param: postData,
            success: function () {
                if (keyValue.length > 0) {
                    $.currentWindow().$("#gridList").trigger("reloadGrid");
                }
                else {
                    window.location.href = "/SystemManage/SysMemScore/Index";
                }
            }
        });
    }
</script>
<form id="form1">
    <table class="form">
        <tr>
            <th class="formTitle">用户</th>
            <td class="formValue">
                <input id="Id" name="Id" type="text" class="form-control" value="" />
                <input id="UserName" name="UserName" type="text" class="form-control" />
            </td>
        </tr>
        <tr>
            <th class="formTitle">操作类型</th>
            <td class="formValue">
                <select id="OperatType" name="OperatType" class="input-small inline form-control" style="width: 100px;float:none;display:inline-block;">
                    <option value="">--请选择--</option>
                    <option value="0">获取</option>
                    <option value="1">消费</option>
                </select>
            </td>
        </tr>
        <tr>
            <th class="formTitle">积分类型</th>
            <td class="formValue">
                <select id="ScoreType" name="ScoreType" class="input-small inline form-control" style="width: 100px;float:none;display:inline-block;">
                    <option value="">--请选择--</option>
                </select>
            </td>
        </tr>
        <tr>
            <th class="formTitle">积分</th>
            <td class="formValue">
                <input id="Score" name="Score" type="text" class="form-control" />
            </td>
        </tr>
        <tr>
            <th class="formTitle">排序</th>
            <td class="formValue">
                <input id="SortCode" name="SortCode" type="text" class="form-control" />
            </td>
        </tr>
        <tr>
            <th class="formTitle" style="height: 35px;">选项</th>
            <td class="formValue" style="padding-top: 1px;">
                <div class="ckbox">
                    <input id="IsDefault" name="IsDefault" type="checkbox"><label for="IsDefault">默认</label>
                </div>
                <div class="ckbox">
                    <input id="EnabledMark" name="EnabledMark" type="checkbox" checked="checked"><label for="EnabledMark">有效</label>
                </div>
            </td>
        </tr>
        <tr>
            <th class="formTitle" valign="top" style="padding-top: 5px;">
                备注
            </th>
            <td class="formValue">
                <textarea id="Description" name="Description" class="form-control" style="height: 60px;"></textarea>
            </td>
        </tr>
        <tr>
            <th class="formTitle">创建人员</th>
            <td class="formValue">
                <input id="CreatorUserId" name="CreatorUserId" type="text" class="form-control" />
            </td>
        </tr>
        <tr>

            <th class="formTitle">创建时间</th>
            <td class="formValue">
                <input id="CreatorTime" name="CreatorTime" type="text" class="form-control" />
            </td>
        </tr>
        <tr>
            <th class="formTitle">修改人员</th>
            <td class="formValue">
                <input id="LastModifyUserId" name="LastModifyUserId" type="text" class="form-control" />
            </td>

        </tr>
        <tr>
            <th class="formTitle">修改时间</th>
            <td class="formValue">
                <input id="LastModifyTime" name="LastModifyTime" type="text" class="form-control" />
            </td>
        </tr>
    </table>
</form>
@section Scripts{
    <script type="text/javascript">
        $(function () {
            $(".formdate").focus(function () {
                var objId = $(this).attr("id");
                WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss', lang: 'zh-cn' });
            });
        });
        
    </script>
}